$def with(lst, pager, query_key = '')
$:render.admin.header(css=['admin/css/popup.css', 'admin/css/media.css'], scripts = ['admin/scripts/core.js'])

<script type="text/javascript">
    var selected = 0;
    var topWin = window.dialogArguments || opener || parent || top;
    $$(function() {
        init_events();
        init_ui();
    });
    function init_ui() {
        var values = topWin.selected_values();
        if (values) {
            $$(':checkbox').each(function () {
                var val = $$(this).val();
                var id = val.split('|')[0];
                if (values.indexOf(id) > -1) {
                    this.checked = true;
                }
            });
            selected = values.length;
            reset_selected_length();
        }
    };
    function init_events() {
        $$(':button').click(function () {
            topWin.$$.fancybox.close();
        });

        // 显示选取数量
        $$(':checkbox').click(function () {
            if (this.checked) {
                incr();
                topWin.top10_selected(this.value, 'add');
            } else {
                decr();
                topWin.top10_selected(this.value, 'remove');
            }
        });
    };
    function decr() {
        selected--;
        reset_selected_length();
    };
    function incr() {
        selected++;
        reset_selected_length();
    };
    function reset_selected_length() {
        var textEL = $$('#selected_text');
        textEL.html(textEL.attr('rel').replace('{0}', selected));
    };
</script>
<div id="media-upload-header">
	<ul id="sidemenu">
		<li id="tab-library"><a href="$config.ADMIN_DIR/hotel?mode=lite" class="current">酒店库</a></li>
	</ul>
</div>

<form id="filter" action="" method="get">
<div class="tablenav">

    <div class='tablenav-pages'>
        $:pager
    </div>
<div class="alignleft actions">
<label class="screen-reader-text" for="media-search-input">搜索酒店:</label>
	<input type="text" class="txt" id="media-search-input" name="q" value="$query_key" />
    <input type="hidden" name="mode" value="lite" />
    <input type="submit" class="btn" value="搜索酒店"  />
</div>

<br class="clear" />
</div>
</form>


<div id="media-items">
    $if lst.totalrecords > 0:
        $for post in lst.result:
            <div id="media-item-$post.id" class="media-item child-of-0 preloaded">
                <img class="pinkynail toggle" src="" />
                <div class="toggle describe-toggle-on"><input type="checkbox" name="post_id" value="$post.id|$post.name" />&nbsp;</div>
                <div class="filename new"><a class="title" href="javascript:;" target="_blank">$:post.name</a></div>
            </div>
    $else:
        <font color="gray">尚未添加酒店信息</font>
</div>
<p class="ml-submit right mr10">
    <input type="button" name="submit" value="确定选择" class="btn" />&nbsp;
    <span id="selected_text" rel="已选择：<strong>{0}</strong> 项">已选择：<strong>0</strong > 项</span>
</p>
